package com.sx.pipeline.adapter

import android.content.Context
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.noober.background.view.BLLinearLayout
import com.noober.background.view.BLTextView
import com.sx.mvvmlibs.base.EasyAdapter
import com.sx.pipeline.R
import com.sx.pipeline.repos.http.res.RechargeInfoVO
import com.sx.pipeline.utils.AndroidUtil

/**
 * author : zhouyouqiang
 * e-mail : 1638473898@qq.com
 * date   : 2022/4/11 15:59
 * desc   : 充值适配器
 * version: 1.0
 */
class RechargeAdapter(
    private val contexts: Context,
    private val footPrintData: List<RechargeInfoVO>,
) : EasyAdapter<String,RechargeViewHolder?>() {

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RechargeViewHolder {
        val view = View.inflate(contexts, R.layout.item_recharge, null)
        return RechargeViewHolder(view)
    }

    override fun getItemCount(): Int {
        return footPrintData.size
    }

    override fun whenBindViewHolder(holder: RechargeViewHolder?, position: Int) {
        // val data = footPrintData[position]
        holder!!.tabRoot.tag = position //绑定
        holder.tvNum.text=footPrintData[position].amountReceived
        holder.tvMoney.text=footPrintData[position].rechargeMoney+"元"
    }
}

class RechargeViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
    var tabRoot: BLLinearLayout = itemView.findViewById(R.id.tab_root)
    var tvNum: BLTextView = itemView.findViewById(R.id.tv_num)
    var tvMoney: BLTextView = itemView.findViewById(R.id.tv_money)

}